import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn' // 分页组件改为中文
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import '../src/assets/style/style.css'
import vue3ResizeDrag from 'vue3-resize-drag'
import router from '../src/router'

const app = createApp(App)
app.use(vue3ResizeDrag)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(router).use(ElementPlus,{locale}).mount('#app')


 console.log(window)
// Singleton instance applied to the sub application
if (window.__POWERED_BY_WUJIE__) {
  // initial data from base app by [window.$wujie.props]
  // const { token, locale, theme } = window.$wujie.props;
  const  {token, locale, theme, userInfo}  = window.$wujie.props;
  sessionStorage.setItem('userInfo',(JSON.stringify(userInfo) ))
  // sessionStorage.setItem('userInfo',(JSON.stringify(userInfo)))
  // let instance: any;
  // window.__WUJIE_MOUNT = () => {
  //   instance = bootstrap(instance);
  // };
  // window.__WUJIE_UNMOUNT = () => {
  //   instance.unmount();
  // };
 
  // window.__WUJIE?.mount();
} else{
  sessionStorage.setItem('userInfo',(JSON.stringify({user:{name:"superuser"}})))
}
